package com.qiwx.pigeon.adapter.home;

import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.qiwx.pigeon.R;
import com.qiwx.pigeon.data.CageStatusConfig;
import com.qiwx.pigeon.data.vo.CageBeanVo;
import com.qiwx.pigeon.data.vo.CageRemindBean;

import java.util.List;

/**
 * @description
 * @Author qiwx
 * @Date 2020-04-06 11:26
 * 空窝 Adapter
 **/
public class CageEmptyAdapter extends BaseQuickAdapter<CageBeanVo, BaseViewHolder> {

    ICageInterface iCageInterface;

    public CageEmptyAdapter(int layoutResId, List<CageBeanVo> data) {
        super(layoutResId, data);
    }

    public void setIPigeonPairInterface(ICageInterface iCageInterface) {
        this.iCageInterface = iCageInterface;
    }

    @Override
    protected void convert(BaseViewHolder holder, CageBeanVo bean) {
        holder.setText(R.id.txt_c_number, bean.getNumber() + "");
        holder.setText(R.id.txt_status, getShowByStatus(bean.getStatus()));
        holder.setText(R.id.btn_opreate, "操作");

        holder.findView(R.id.btn_opreate).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (iCageInterface != null) {
                    iCageInterface.onSelectId(holder.getAdapterPosition(), bean.getId(),0);
                }

            }
        });

    }

    public static String getShowByStatus(int status) {
        if (status == CageStatusConfig.STATUS_KL) {
            return "空笼";
        } else {
            return "存栏";
        }
    }


}
